from src.video.VideoSimilaryCaculator import VideoSimilaryCaculator
from src.video.baseInfo.VideoFolderInfo import VideoFolderInfo
from src.video.Copywriter import  Copywriter
from src.video.VideoCompositor import VideoCompositor
from src.video.VideoCompositorNoSrt import VideoCompositorNosrt
from src import settings

def make_video(root_path,grap_second,top_num,with_orgin_audio,use_src):
    videoFolderInfo = VideoFolderInfo(root_path,use_src)

    videoSimilaryCaculator =  VideoSimilaryCaculator(videoFolderInfo,pic_num_per_second=3)
    videoHeapsList = videoSimilaryCaculator.process(test=False,grap_second=grap_second,top_num=top_num)

    if use_src:
        # copywriter = Copywriter(settings.CHATGPT_URL,settings.CHROME_DRIVER_PATH,videoFolderInfo)
        # copywriter.process()

        videoCompositor = VideoCompositor(videoFolderInfo,videoHeapsList,3,True,with_audio=with_orgin_audio)
        videoCompositor.process()
    else:
        videoCompositorNoSrt = VideoCompositorNosrt(videoFolderInfo, videoHeapsList, 3, True,grap_second)
        videoCompositorNoSrt.process()
    #
    #
    # copywriter = Copywriter(settings.CHATGPT_URL,settings.CHROME_DRIVER_PATH,videoFolderInfo)
    # copywriter.process()

if __name__ == '__main__':
    # root_path = r'E:\movie\20231215-真的爱你'
    # grap_second = 60#60#12
    # top_num = 6#6 #3
    # with_orgin_audio = True
    # use_srt = False
    # make_video(root_path,grap_second,top_num,with_orgin_audio,use_srt)

    root_path = r'E:\movie\20231230-赛琳娜的黄金'
    grap_second = 60  # 60#12
    top_num = 6  # 6 #3
    with_orgin_audio = True
    use_srt = True
    make_video(root_path, grap_second, top_num, with_orgin_audio, use_srt)
